#include "compressfile.h"
#include <unistd.h>

void usage(char *proc){
    // ...
    printf("usage:%s [option] file\n\n", proc);
    printf("option:\n");
    printf("    --\n");
    printf("    -c       compress file\n");
    printf("    -u       uncompress file\n");
    printf("    -h       print Help (this manual) and exit\n\n");
    printf("example:\n");
    printf("    ./main -c 1.txt\n");
    exit(1);
}

int main(int argc, char *argv[])
{
    if(argc != 3){
        usage(argv[0]);
    }

    char ch;
    while((ch=getopt(argc, argv, "c:u:h")) != EOF){
        switch(ch){
        case 'c':
            TestFileCompress(argv[2]);
            break;
        case 'u':
            TestFileUncompress(argv[2]);
            break;
        case 'h':
        default:
            usage(argv[0]);
        }
    }

    return 0;
}
